﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FortuneHeaven.Admin.Common;
using FortuneHeavenBAL;
using FortuneHeavenCommon.DataMap;

namespace FortuneHeaven.Admin.Pages.GameManager
{
    public partial class UserInforDetail_PurchaseShow : FortuneHeaven.Admin.Common.PageBase
    {

        public override string PageID
        {
            get { return "F56"; }
        }
        private string pre = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            this.usPager.PagerChanged += new Admin.Controls.Pagination.PagerChangeHandler(usPager_PagerChanged);
            if (!IsPostBack)
            {
                this.usPager.PageSize = 10;
                if (ID >= 0)
                {
                    AccountsInfoBO bo = new AccountsInfoBO();
                    AccountsInfo g = bo.GetAcount(ID);

                    this.lbAcount.Text = g.RegAccounts;
                    this.lbGameID.Text = g.GameID.ToString();
                    ResetList();
                }
            }
        }

        void usPager_PagerChanged(object sender, int currentpage)
        {
            GameShowOrdersBO gift = new GameShowOrdersBO();
            this.rpSpread.DataSource = gift.GetShowOrders(this.usPager.CurrentPageIndex, this.usPager.PageSize, ID);
            rpSpread.DataBind();
        }

        public void ResetList()
        {
            GameShowOrdersBO gift = new GameShowOrdersBO();
            this.usPager.RecordCount = gift.GetTotalSize(ID);
            this.usPager.PageSize = 10;
            this.usPager.Initial();
            this.usPager.CurrentPageIndex = 1;
        }

        public new int ID
        {
            get
            {
                return string.IsNullOrEmpty(Request["ID"]) ? -1 : int.Parse(Request["ID"]);
            }
        }

        public string Pre
        {
            get
            {
                if (!string.IsNullOrEmpty(pre))
                    return pre;
                else
                    pre = Server.UrlDecode(Request["pre"]);
                return pre;
            }
        }


        public void CancelSave(object sender, EventArgs arg)
        {
            if (!string.IsNullOrEmpty(Pre))
            {
                Response.Redirect(Pre);
            }
        }
    }
}